﻿<ResourceDictionary
    x:Class="Poet.Resources.Styles"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="..\Resources\ControlTemplates.xaml" />
        <ResourceDictionary Source="..\Resources\Converters.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <DataTemplate x:Key="BrushComboBoxItemTemplate">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Rectangle
                Grid.Column="0"
                RadiusX="2" RadiusY="2"
                Width="12" Height="12" 
                Stroke="DarkGray"
                VerticalAlignment="Center" 
                StrokeThickness="1"
                Fill="{Binding Fill}"/>
            <TextBlock Grid.Column="1" Text="{Binding Name}" Width="Auto" HorizontalAlignment="Stretch" Margin="4,2"/>
        </Grid>
    </DataTemplate>
    
    <!--<Style TargetType="{x:Type GridView}">
        <EventSetter Event="GridViewColumnHeader.Click" Handler="GridViewColumnHeaderClickedHandler"></EventSetter>
    </Style>

    <Style TargetType="{x:Type GridViewColumnHeader}">
        <EventSetter Event="Click" Handler="GridViewColumnHeaderClickedHandler"></EventSetter>
    </Style>-->

    <Style x:Key="StatusBarTextBlockStyle" TargetType="{x:Type TextBlock}">
        <Setter Property="Margin" Value="2 0 8 0"/>
        <Setter Property="MinWidth" Value="40"/>
    </Style>

    <Style x:Key="Container" TargetType="{x:Type StackPanel}">
        <Setter Property="Orientation" Value="Horizontal"/>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="Margin" Value="0 0 0 0"/>
    </Style>

    <Style x:Key="CheckableItemStyle" TargetType="{x:Type MenuItem}">
        <Setter Property="IsCheckable" Value="True"/>
        <Setter Property="IsChecked" Value="{Binding Visibility, Converter={StaticResource VisibilityToBooleanConverter}}"/>
        <Setter Property="Header" Value="{PropertyLocalizing Tag}"/>
    </Style>

    <Style x:Key="AutoUpdateBindingsStyle" TargetType="{x:Type MenuItem}">
        <EventSetter Event="Loaded" Handler="UbdateBindings"/>
        <EventSetter Event="PreviewGotKeyboardFocus" Handler="UbdateBindings"/>
        <EventSetter Event="MouseMove" Handler="UbdateBindings"/>
    </Style>

    <Style x:Key="CheckableStyle" TargetType="{x:Type MenuItem}">
        <EventSetter Event="PreviewMouseLeftButtonDown" Handler="InvertIsChecked" />
        <EventSetter Event="PreviewMouseDoubleClick" Handler="InvertIsChecked" />
        <Setter Property="StaysOpenOnClick" Value="True" />
        <!--<Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsEnabled" Value="False"/>
                    <Condition Property="IsChecked" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="Black"/>
            </MultiTrigger>
        </Style.Triggers>-->
    </Style>

    <!--<SnippetComboBoxStyle>-->
    <Style TargetType="ComboBox" x:Key="{x:Type ComboBox}">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="MinWidth" Value="32"/>
        <Setter Property="MinHeight" Value="20"/>
        <Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/>
        <Style.Triggers>
        </Style.Triggers>
    </Style>

    <Style TargetType="ComboBox" BasedOn="{StaticResource ResourceKey={x:Type ComboBox}}" x:Key="BrushComboBoxStyle">


    </Style>
    <!--</SnippetComboBoxStyle>-->
    <!--</Snippet5>-->

    <!-- SimpleStyles: ComboBoxItem -->
    <!--<Snippet6>-->
    <Style x:Key="{x:Type ComboBoxItem}" TargetType="ComboBoxItem">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Template" Value="{StaticResource ComboBoxItemTemplate}"/>
    </Style>

    <Style x:Key="SearchComboBoxItemStyle" TargetType="ComboBoxItem">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Template" Value="{StaticResource SearchComboBoxItemTemplate}"/>
    </Style>
    <!--</Snippet6>-->

    <!-- Focus Visual -->
    <!--<SnippetCheckBoxFocusVisual>-->
    <Style x:Key="CheckBoxFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border>
                        <Rectangle 
              Margin="15,0,0,0"
              StrokeThickness="1"
              Stroke="#60000000"
              StrokeDashArray="1 2"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--</SnippetCheckBoxFocusVisual>-->

    <!-- SimpleStyles: CheckBox -->
    <!--<Snippet11>-->
    <Style x:Key="CheckBox" TargetType="CheckBox">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="FocusVisualStyle"	Value="{StaticResource CheckBoxFocusVisual}"/>
        <Setter Property="Template" Value="{StaticResource CheckBoxTemplate}"/>
    </Style>
    <!--</Snippet11>-->

    <!--<SnippetButtonFocusVisual>-->
    <Style x:Key="ButtonFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border>
                        <Rectangle 
              Margin="2"
              StrokeThickness="1"
              Stroke="#60000000"
              StrokeDashArray="1 2"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--</SnippetButtonFocusVisual>-->

    <!-- SimpleStyles: Button -->

    <Style TargetType="{x:Type StackPanel}" x:Key="{x:Type StackPanel}">
        <Setter Property="Margin" Value="0"/>
    </Style>

    <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="12"/>
    </Style>

    <Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}">
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="12"/>
    </Style>

    <!--<Snippet1>-->
    <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
        <Setter Property="Margin" Value="4"/>
        <Setter Property="Padding" Value="16 1 16 1"/>
        <Setter Property="MinWidth" Value="70"/>
    </Style>

    <Style TargetType="{x:Type Button}" x:Key="CustomButtonStyle">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
        <Setter Property="Template" Value="{StaticResource ButtonTemplate}"/>
    </Style>
    <!--</Snippet1>-->

    <!-- SimpleStyles: TextBox -->
    <!--<Snippet15>-->
    <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBoxBase}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinWidth" Value="120"/>
        <Setter Property="MinHeight" Value="20"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Template" Value="{StaticResource TextBoxTemplate}"/>
    </Style>

    <Style TargetType="{x:Type Image}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type ButtonBase}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
                <Setter Property="Opacity" Value="0.30" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>